<!--/* SocialHistory -->
<!--
Code: Observation.code.text || Observation.code.coding[x].display (separated by <br />)
Result: Observation.valueQuantity || Observation.valueDateTime || Observation.valueCodeableConcept.text || Observation.valueCodeableConcept.coding[x].display (separated by <br />) || Observation.valueString
Unit: Observation.valueQuantity.unit
Comments: Observation.note[x].text (separated by <br />)
Date: Observation.effectiveDateTime || Observation.effectivePeriod.start
*/-->
<div xmlns:th="http://www.thymeleaf.org">
   <h5>Social History</h5>
   <table class="hapiPropertyTable">
      <thead>
      <tr>
         <th>Code</th>
         <th>Result</th>
         <th>Unit</th>
         <th>Comments</th>
         <th>Date</th>
      </tr>
      </thead>
      <tbody>
      <th:block th:each="entry : ${resource.entry}" th:object="${entry.getResource()}">
         <th:block th:unless='*{getResourceType().name() == "Composition"}'>
            <th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
               <tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
                  <td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getCode()},attr='display')}">Code</td>
                  <td th:insert="~{IpsUtilityFragments :: renderValue (value=*{getValue()})}">Result</td>
                  <td th:insert="~{IpsUtilityFragments :: renderValueUnit (value=*{getValue()})}">Unit</td>
                  <td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
                  <td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getEffective()})}">Date</td>
               </tr>
            </th:block>
         </th:block>
      </th:block>
      </tbody>
   </table>
</div>
